{% extends "base.html" %}
{% block title %}
    职员管理
{% endblock %}
{% block head %}
    <!-- Bootstrap Core CSS -->
    <link href="/static/lib/sb-admin/vendor/bootstrap/css/bootstrap.min.css" rel="stylesheet">

    <!-- MetisMenu CSS -->
    <link href="/static/lib/sb-admin/vendor/metisMenu/metisMenu.min.css" rel="stylesheet">

    <!-- Custom CSS -->
    <link href="/static/lib/sb-admin/dist/css/sb-admin-2.css" rel="stylesheet">

    <!-- Custom Fonts -->
    <link href="/static/lib/sb-admin/vendor/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css">

    <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
    <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
    <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
{% endblock %}
{% block label %}
    <h1 class="page-header">职员管理</h1>
{% endblock %}
{% block contenter %}
    <div class="row">
        <div class="col-lg-8">
            {% for d in d_list %}
                <a class="btn btn-default" href="/oa_system/person/{{ d.D_name }}/">{{ d.D_name }}</a>
            {% endfor %}
        </div>
        <form role="form" class="col-lg-3" method="post" action ='/oa_system/search_user/'>
            <div class="form-group input-group">
               <input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
                <input type="text" name="person_username" class="form-control" placeholder="输入要搜索的雇员的名字"
                       value="">
                <span class="input-group-btn">
                    <button class="btn btn-default" type="submit">
                        <i class="fa fa-search"></i>
                    </button>
                </span>
            </div>
        </form>
        <div class="col-lg-1">
            <a class="btn btn-default" href="/oa_system/add_person/">添加</a>
        </div>
    </div>
    <div class="row">
        <table class="table">
            <thead>
            <tr>
                <th>职员用户名</th>
                <th>职员部门</th>
                <th>职员职位</th>
                <th>操作</th>
            </tr>
            </thead>
            <tbody>
            {% for p in person_list.items %}
                <tr>
                    <td>{{ p.p_pe.P_name }}</td>
                    <td>{{ p.per_P.Pos_D.D_name }}</td>
                    <td>{{ p.per_P.Pos_name }}</td>
                    <td>
                        <a class="btn btn-default" href="/oa_system/detail_person/{{ p.id }}/">详情</a>
                        <a class="btn btn-default" href="/oa_system/edit_person/{{ p.id }}/">编辑</a>
                        <a class="btn btn-default" href="/oa_system/delete_person/{{ p.id }}/">删除</a>
                    </td>
                </tr>
            {% endfor %}
            </tbody>
        </table>
    </div>
    <ul class="pagination pull-right">
        {% if person_list.has_prev %}
            <li><a href="/oa_system/person/?page=1">首页</a></li>
            <li><a href="/oa_system/person/?page={{ person_list.prev_num }}">上一页</a></li>
        {% endif %}
        {% for num in person_list.iter_pages(1,1,2,1) %}
            {% if num %}
                {% if num == person_list.page %}
                    <li><a href="#">{{ num }}</a></li>
                {% else %}
                    <li><a href="/oa_system/person/?page={{ num }}">{{ num }}</a></li>
                {% endif %}
            {% else %}
                <li><a href="#">...</a></li>
            {% endif %}
        {% endfor %}
        {% if person_list.has_next %}
            <li><a href="/oa_system/person/?page={{ person_list.next_num }}">下一页</a></li>
            <li><a href="/oa_system/person/?page={{ person_list.pages }}">尾页</a></li>
        {% endif %}
    </ul>

{% endblock %}
{% block body %}
    <!-- /#wrapper -->

    <!-- jQuery -->
    <script src="/static/lib/sb-admin/vendor/jquery/jquery.min.js"></script>

    <!-- Bootstrap Core JavaScript -->
    <script src="/static/lib/sb-admin/vendor/bootstrap/js/bootstrap.min.js"></script>

    <!-- Metis Menu Plugin JavaScript -->
    <script src="/static/lib/sb-admin/vendor/metisMenu/metisMenu.min.js"></script>

    <!-- Custom Theme JavaScript -->
    <script src="/static/lib/sb-admin/dist/js/sb-admin-2.js"></script>
{% endblock %}
